Restore Node 24 (and before) behavior as fs.existsSync() now throws deprecation warning - #474
Conversation
…en passed invalid undefined/objects
✅ Deploy Preview for lando-core ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Thanks for tracking this down! The Node 24 diagnosis looks right, and it should be possible to fix while retaining Node 20 compatibility. Could we avoid globally monkey-patching Node's I'd suggest a small explicit helper that returns |
Node 24 deprecated passing anything that is not a string, Buffer or URL to fs.existsSync(). Older Node quietly returned false, which a number of lando call sites relied on: they pluck optional keys off plugin and config objects and just want a "is there a file there?" answer. On Node 24 those now emit a DeprecationWarning to stderr on more or less every lando invocation. Add utils/exists-sync.js, which returns false for non path-like values and otherwise defers to fs.existsSync(). Also expose it as utils.existsSync so plugins can use it.
Privileged Leia tests skippedThe After reviewing gh workflow run pr-core-tests.yml --repo lando/core -f pull_request=474 -f commit_sha=179d88cb19803b5e4b006787ed8378259fb4bb3cor from the workflow page using the same inputs. This comment updates when new commits are pushed and the dispatch only accepts the current head commit. |

The problem
Execution of lando results in the following error:
What was wrong
Node 24 introduced deprecation DEP0187:
fs.existsSync()now warns when passed anything that isn't a string/Buffer/URL. Older Node silently returned false. Lando relies on that old behavior in many places — it callsfs.existsSync(x)where x is often undefined or an object (e.g. plugin dirs that don't exist, config source objects). Each command bootstraps different subsystems, so different call sites fired.The fix
Rather than guard dozens of individual call sites (fragile and incomplete), I added a single global shim at Lando's entry point at @lando/core/bin/lando:
This restores the pre-Node-24 semantics (non-path argument returns false), so behavior is unchanged, just no warning.